import request from '@/utils/request'

export const getCouponList = (page, limit) =>
  request({ url: `admin/activity/couponInfo/${page}/${limit}`, method: 'get' })

// 搜索
export const searchCoupon = (keyword) =>
  request({
    url: `/admin/activity/couponInfo/findCouponByKeyword/${keyword}`,
    method: 'get'
  })

//添加,修改优惠券
export const addCouponInfo = (data) =>
  request({
    url: data.id
      ? `/admin/activity/couponInfo/update`
      : `/admin/activity/couponInfo/save`,
    method: data.id ? 'put' : 'post',
    data
  })

//删除优惠券
export const delCouponInfo = (id) =>
  request({ url: `/admin/activity/couponInfo/remove/${id}`, method: 'delete' })

// 批量删除
export const delCouponBatch = (data) =>
  request({
    url: `/admin/activity/couponInfo/batchRemove`,
    method: 'delete',
    data
  })
